<!DOCTYPE html>

<html lang="zh-cn" xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
    <meta name="format-detection" content="telephone=no" />
    <title>就医住宿</title>
    <link href="../css/ekang.css" rel="stylesheet" />
    <link href="../css/chooseDoctor_css/style.css" rel="stylesheet" />
    <link href="../css/chooseDoctor_css/styleProgress.css" rel="stylesheet" />
    <link rel="stylesheet" href="../css/framework7.ios.min.css">
    <link rel="stylesheet" href="../css/framework7.ios.colors.min.css">
    <!-- Path to your custom app styles-->
    <link rel="stylesheet" href="../css/my-app.css">
    <style>
        body {
            font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
            font-size: 14px;
            margin: 0;
            padding: 0;
            color: #6C6C6C;
        }

        .reservation {
            background-color: #ffffff;
            border-bottom: solid 1px #e6e6e6;
        }

        .reservation_title {
            padding: 7px;
            color: #43af80;
            font-size: 13px;
            border-bottom: solid 1px #e6e6e6;
        }

        .reservation_title img{
            width: 12px;
            height: 12px;
            margin-right:5px;

        }
        .reservation_table {
            text-align: center;
            padding: 7px;
        }

        #reservation_table a {
            /* color: #FFFFFF;*/
        }

        .special_border {
            border-collapse: inherit;
            border-spacing: 1px;
        }

        .reservation table {
            width: 100%;
            background-color: #e6e6e6;
        }

        .reservation td {
            background-color: white;
            text-align: center;
            width: 40px;
            height: 40px;
        }

        .reservation .font {
            font-size: 11px;
            color: #4a4a4a;
        }

        .reservation .num {
            font-size: 7px;
            color: #939393;
        }

        .reservation .title {
            font-size: 11px;
        }

        table {
            width: 100%;
        }

        .reservation_time{
            font-family:STHeiti;
            font-weight: inherit;
            text-align: center;
            font-size: 13px;
            margin-top: 10px;
            color: #79807d;
            font-style: inherit;
        }

        .commment_list img{
            width: 15%;
            margin-left: 10px;
            margin-top: 10px;
            float: left;
        }

        .backView {
            width: 100%;
            height: 50px;
            margin-top: 10px;
            background-color: #fff;
            border-top: 1px solid #dddddd;
            border-bottom: 1px solid #dddddd;
            list-style-type: none;
        }

        .li-title {
            position: absolute;
            color: #333333;
            font-size: 14px;
            left: 12px;
            line-height: 50px;
            /*font-weight: bold;*/
        }

        .choose {
            float:left;
            margin:0 10px;
            display:inline;
            color: #333333;
            font-size: 14px;
            margin-top: 13px;
            height: 24px;
            line-height: 24px;
            border-radius: 12px;
        }

        .choose-on {
            background-color: #43af80;
            color: #fff;
        }

        #nures_time ::-webkit-input-placeholder { color: #333333;text-align: right }

        ::-webkit-input-placeholder { color: #b3b3b3;}
        input:-moz-placeholder { color: #b3b3b3; }

        .li-text {
            position: absolute;
            color: #b3b3b3;
            border: none;
            outline: none;
            font-size: 15px;
            line-height: 45px;
            right: 0;
            width: 60%;
            text-align: right;
            background-color: rgba(102, 102, 102, 0);
        }

        .li-title-detail {
            position:absolute;
            color: #b3b3b3;
            border: none;
            outline: none;
            font-size: 15px;
            right: 0;
            text-align: left;
            /*background-color:#009688;*/
            width: 94%;
            height: 79px;
            left: 10px;
            top: 5px;
        }

        .icon-right {
            background: url(../img/right_24.png) no-repeat 98% center transparent;
            background-color: #fff;
            background-size: 12px 12px;
        }

        .tabs-choose {
            /*height: 50px;*/
            line-height: 50px;
            position: absolute;
            background-color: rgba(255, 255, 255, 0);
            right: 25px;
            color: #333333;
        }

        .tabs-choose div {
            background-origin: content-box;
            font-size: 14px;
            text-align: right;
        }

        .botton_bt {
            
            margin-bottom: 0;
            width: 100%;
            height: 49px;
            background-color: #43af80;
            border: none;
            color: white;
            font-size: 14px;
        }
    </style>

</head>
<body>

<!--// 导航条-->
<div style="width: 100%;height: 45px;background-color: #38a16d;position: fixed;z-index: 10000">
    <h1 class="nav-title" style="font-size: 18px;line-height: 45px">就医住宿</h1>
    <img src="../img/BackIcon.png" alt="返回" class="nav-backImg" id="back"/>
</div>
<div>
    <ui>
        <li id="hospitalDetail" class="backView icon-right" style="margin-top: 45px">
            <span class="li-title" id="chooseText">我要住哪个医院附近</span>
        </li>
    </ui>
    <!-- 预约日期 -->
    <div class="reservation" style="margin-top: 10px;border-top: 1px solid #e6e6e6">
        <div class="reservation_title">
            <img src="../img/doctorDetail/docter/矩形-3@2x.png">
            开始入住时间
        </div>

        <!--滚动-->
        <div class="container" style="height: 210px">
            <section class="sample" data-slidizle>

                <ul class="slider-content" data-slidizle-content>

                    <li class="slider-item">

                        <div class="reservation_time" id="table_time_01">
                            日期
                        </div>
                        <div class="reservation_table">
                            <table id="table01" class="special_border" cellspacing="1" cellpadding="5">
                                <tr>
                                    <td class="t_l_radius"><img src="../img/doctorDetail/calendar.png" width="18" height="18" /></td>
                                    <td></td>
                                    <td></td>
                                    <td></td>
                                    <td></td>
                                    <td></td>
                                    <td></td>
                                    <td class="t_r_radius"></td>
                                </tr>
                                <tr>
                                    <td class="title">上午</td>
                                    <td></td>
                                    <td></td>
                                    <td></td>
                                    <td></td>
                                    <td></td>
                                    <td></td>
                                    <td></td>
                                </tr>
                                <tr>
                                    <td class="title">下午</td>
                                    <td></td>
                                    <td></td>
                                    <td></td>
                                    <td></td>
                                    <td></td>
                                    <td></td>
                                    <td></td>
                                </tr>

                            </table>
                        </div>
                    </li>

                    <li class="slider-item">

                        <div class="reservation_time" id="table_time_02">
                            日期
                        </div>
                        <div class="reservation_table">
                            <table id="table02" class="special_border" cellspacing="1" cellpadding="5">
                                <tr>
                                    <td class="t_l_radius"><img src="../img/doctorDetail/calendar.png" alt="" width="18" height="18" /></td>
                                    <td></td>
                                    <td></td>
                                    <td></td>
                                    <td></td>
                                    <td></td>
                                    <td></td>
                                    <td class="t_r_radius"></td>
                                </tr>
                                <tr>
                                    <td class="title">上午</td>
                                    <td></td>
                                    <td></td>
                                    <td></td>
                                    <td></td>
                                    <td></td>
                                    <td></td>
                                    <td></td>
                                </tr>
                                <tr>
                                    <td class="title">下午</td>
                                    <td></td>
                                    <td></td>
                                    <td></td>
                                    <td></td>
                                    <td></td>
                                    <td></td>
                                    <td></td>
                                </tr>

                            </table>
                        </div>
                    </li>


                    <li class="slider-item">
                        <div class="reservation_time" id="table_time_03">
                            日期

                        </div>
                        <div class="reservation_table">
                            <table id="table03" class="special_border" cellspacing="1" cellpadding="5">
                                <tr>
                                    <td class="t_l_radius"><img src="../img/doctorDetail/calendar.png" width="18" height="18" /></td>
                                    <td></td>
                                    <td></td>
                                    <td></td>
                                    <td></td>
                                    <td></td>
                                    <td></td>
                                    <td class="t_r_radius"></td>
                                </tr>
                                <tr>
                                    <td class="title">上午</td>
                                    <td></td>
                                    <td></td>
                                    <td></td>
                                    <td></td>
                                    <td></td>
                                    <td></td>
                                    <td></td>
                                </tr>
                                <tr>
                                    <td class="title">下午</td>
                                    <td></td>
                                    <td></td>
                                    <td></td>
                                    <td></td>
                                    <td></td>
                                    <td></td>
                                    <td></td>
                                </tr>

                            </table>
                        </div>
                    </li>

                </ul>

                <!-- 下面三个点 -->
                <ul class="slider-navigation" data-slidizle-navigation>
                    <!-- automatically generated navigation -->
                </ul>

            </section>
        </div>
    </div>

    <ui>
        <li id="creat-picker" class="icon-right backView">
            <span class="li-title">入住天数</span>
            <input placeholder="点击选择" type="text" disabled="disabled" id="nures_time" class="tabs-choose text-center" style="text-align:right;border: none;background-color: rgba(0, 0, 0, 0);line-height: 45px">
        </li>

        <li id="creat-picker2" class="icon-right backView">
            <span class="li-title">入住人数</span>
            <input placeholder="请输入入住人数" type="text" disabled="disabled" id="person_num" class="tabs-choose text-center" style="text-align:right;border: none;background-color: rgba(0, 0, 0, 0);line-height: 45px">
        </li>
    </ui>

    <p style="font-size: 12px;margin-left: 10px;margin-top:10px;color: #999999">住宿的价格根据酒店的实际价格收费，易康就医不收取任何服务费用</p>

    <button class="botton_bt">立即预约</button>
</div>

<script src="../js/jquery-1.10.2.js" type="text/javascript"></script>
<script src="../js/ekang.js"></script>
<script src="../js/jquery.slidizle.js"></script>
<script type="text/javascript" src="../js/framework7.min.js"></script>
<script type="text/javascript" src="../js/my-app.js"></script>
<script src="../js/jquery.cookie.js"></script>
<script>

    $(function () {

        var appointment_time;
        var time;

        //初始化滚动条
        $('[data-slidizle]').slidizle({
            beforeChange : function(api) {
                console.log('previous', api.getPreviousSlide().index());
                console.log('current', api.getCurrentSlide().index());
                console.log('next', api.getNextSlide().index());
                console.log('previous active', api.getPreviousActiveSlide().index());
            }
        });

        $('#hospitalDetail').click(function () {
            location.href = "../hospitalInformation/hospitalList.html?type=300";
        });

        if($.cookie("accom_hospital_name")){
            $('#chooseText').html($.cookie("accom_hospital_name"));
        }

        var app = {
            getworktime: function () {
                $.ajax({
                    type: 'GET',
                    url: textUrl + '/index/getWorkTime',
                    data: {         // 需要于客户端同步
                        uid : ''
                    },
                    dataType: 'jsonp',
                    jsonp: 'callback',
                    success: function (result) {
                        if (result.ret == 0) {

                            ///////医生排版信息
                            var workTime = result.data;

                            var now_data = workTime.now_week;

                            for (var now_index in now_data) {

                                var obj = now_data[now_index];

                                loadData("table01", obj, parseInt(now_index) + parseInt(1));

                                if(now_index==0){

                                    $("#table_time_01").text(obj.current_year);
                                }
                            }

                            var next_data = workTime.next_week;
                            for (var next_index in next_data) {


                                var obj = next_data[next_index];

                                loadData("table02", obj, parseInt(next_index) + parseInt(1));

                                if(next_index==0){

                                    $("#table_time_02").text(obj.current_year);
                                }

                            }


                            var next_next_data = workTime.next_next_week;
                            for (var next_next_index in next_next_data) {

                                var obj = next_next_data[next_next_index];

                                loadData("table03", obj, parseInt(next_next_index) + parseInt(1));

                                if(next_next_index==0){

                                    $("#table_time_03").text(obj.current_year);
                                }
                            }
                        } else {
                            alert(result.msg);
                        }
                    }
                });
            },
            subOrder: function () {
                $.ajax({
                    type: 'GET',
                    url: textUrl + '/diagnosis/submitOrder/',
                    data: {         // 需要于客户端同步

                        hospital_id : $.cookie("accom_hospital_id"),
                        appointment_type : '5',
                        type : '5',
                        uid : $.cookie("local_userId"),
                        appointment_time: $.myTime.DateToUnix("2016-"+appointment_time),
                        day_time : time,
                        person_num : $('#nures_time').val(),
                        stay_days : $('#person_num').val()

                    },
                    dataType: 'jsonp',
                    jsonp: 'callback',
                    success: function (result) {
                        if (result.ret == 0) {
//                            var order = result.data.order_id;
//                            location.href = "../hospital_nurse/nurse_payorder.html?order_id="+order;
                            alert("预约信息提交成功，请等待客服人员联系您。如有疑问，请拨打：4006-305060");
                            history.back();
                        } else {
                            alert(result.msg);
                        }
                    }
                });
            }
        };

        /**
         * 加载排班表数据
         */
        function loadData(tableId, obj, index) {

            //设置表头日期
            $("#" + tableId + " tr:eq(0) td:eq(" + index + ")").html('<span class="font">' + obj.week_text + '</span><br/><span class="num">' + obj.date + '</span>');

            //设置上午
            if (obj.am == 0) {
                $("#" + tableId + " tr:eq(1) td:eq(" + index + ")").css("background-color", "#fff");
                $("#" + tableId + " tr:eq(1) td:eq(" + index + ")").html("");
            } else {
                $("#" + tableId + " tr:eq(1) td:eq(" + index + ")").css("background-color", "#fff");
                $("#" + tableId + " tr:eq(1) td:eq(" + index + ")").on('click', function () {
                    $('.reservation_table table td').css("background-color", "#fff");
                    $(this).addClass($(this).css("background-color", "#43AF80"));
                    $(this).html('<span class="font" style="color: #fff">' + obj.week_text + '</span><br/><span class="num" style="color: #fff">上午</span>');
                    appointment_time = obj.date;
                    time = 1;
                });
            }

            //设置下午
            if (obj.pm == 0) {
                $("#" + tableId + " tr:eq(2) td:eq(" + index + ")").css("background-color", "#fff");
                $("#" + tableId + " tr:eq(2) td:eq(" + index + ")").html("");
            } else {
                $("#" + tableId + " tr:eq(2) td:eq(" + index + ")").css("background-color", "#fff");
                $("#" + tableId + " tr:eq(2) td:eq(" + index + ")").on('click', function () {
                    $('.reservation_table table td').css("background-color", "#fff");
                    $(this).addClass($(this).css("background-color", "#43AF80"));
                    $(this).html('<span class="font" style="color: #fff">' + obj.week_text + '</span><br/><span class="num" style="color: #fff">下午</span>');
                    appointment_time = obj.date;
                    time = 2;
                });
//                $("#" + tableId + " tr:eq(2) td:eq(" + index + ")").html('<a href="doctor_appointment.html?am=2&day='+obj.day+'&time='+obj.date+'" style="color: white;font-size: 11px">立即<br/>预约</a>');
            }

        }

        app.getworktime();


        $('.botton_bt').click(function () {
            if($.cookie("local_userId")){
                if($('#chooseText').text()=='我要住哪个医院附近'){
                    alert('请选择医院')
                    return;
                }
                if(!appointment_time){
                    alert('请选择时间')
                    return;
                }
                if($('#nures_time').val()==''){
                    alert('请填写入住天数')
                    return;
                }
                if($('#person_num').val()==''){
                    alert('请填写入住人数')
                    return;
                }

                app.subOrder();
                //location.href = "../login.html";
            }else{
                location.href = "../login.html";
            };

        });

        $('#back').click(function () {
            history.back();
        });

        // 声明f7
        var myApp = new Framework7();
        var $$ = Dom7;
        // 选择日期
        var today = new Date();

        //-----------------陪诊时间

        dropDown($('#creat-picker2'),'#person_num')
        dropDown($('#creat-picker'),'#nures_time')

    });
</script>
<script src="http://res.wx.qq.com/open/js/jweixin-1.0.0.js" type="text/javascript"></script>
<script src="../js/weixin2.js"></script>
</body>
</html>